const exApp = require('../index.js')
const express = require('express');
const router = express.Router();
const mysql = require("../connect/pomsql")
const { SuccessModule, ErrorModule } = require('../model/resModel')

// 以上是固定写法
// 每添加一个需要在index.js中引入

router.get('/a', async (req, res, next) => {
  let sql = 'select * from users'
  let result = await mysql(sql)
  if (result) {
    res.json(new SuccessModule(result))
    return
  }

  res.json(new ErrorModule('操作失败'))
})



// 一下是固定写法
exApp.use('/', router);